<?php
/**
 * @link https://www.kancloud.cn/cleverstone/ymb2
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

namespace builder\form;

/**
 * 表单trait
 * @author cleverstone
 * @since ym2.0
 */
trait FormTrait
{
    /**
     * 生成控件ID
     * @param string $groupField 分组字段
     * @param string $ctrlField 控件字段
     * @return string
     */
    protected function generateFormCtrlId($groupField, $ctrlField)
    {
        return $groupField . '__' . $ctrlField;
    }

    /**
     * 生成控件的ng-model
     * @param string $groupField 表单分组
     * @param string $ctrlField 控件字段
     * @return string
     */
    protected function generateJavascriptScope($groupField, $ctrlField)
    {
        return $groupField . "['{$ctrlField}']";
    }
}